<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>好车e贷</title>

	<!-- 公共样式  -->
	<inline src="include-html/head-css.html" />
	<!-- 依赖外部样式 -->
	<link rel="stylesheet" href="css/components/title.css" media="screen" />
	<link rel="stylesheet" href="css/components/crumbs.css" media="screen" />
	<!-- 本页面样式 -->
	<link rel="stylesheet" href="css/pages/onlinefinance/loan/styles.css" media="screen" />
	<link rel="stylesheet" href="css/pages/onlinefinance/loan/survey.css" media="screen" />
	<link rel="stylesheet" href="css/pages/onlinefinance/loan/jquery-ui.css" />
</head>
<body>
	<inline src="include-html/header.html" />
	
	 <!-- begin | nav -->
    <div class="wrapper bread">
        <div class="title-blue crumbs-nav">
            <a href="javascript:void(0)">车享商城</a>
            <i class="crumbs-arrow">&gt;</i>
            <a href="javascript:void(0)">贷款购车</a>
            <i class="crumbs-arrow">&gt;</i>
            <a href="javascript:void(0)">贷款定制</a>
        </div>
    </div>
    <!-- end | nav -->
	
	<!-- start | 贷款-->
    <div class="wrapper filter-block">
    
		<div class="test_finance white_background">
			<div class="one_column_content">
				<!-- 问卷开始 -->
				<div class="line_ask_answer">				
					<div class="three_steps">
						<p class="font_heading_one">私人贷款定制</p>
					</div>
					<p class="ask_answer_text dark_text font_heading_two">我们为您准备了<span class="question_count"></span>道关于您个人基本信息的选择题，以方便计算出您的贷金券额度，请保证您填写信息的真实性。<a class="base_blue" href="http://www.haocheedai.com/help_customerHelp.html#tab_1">了解更多</a></p>
			
					<div class="test_survey">
						<div class="container">
							<div class="content">
								<div class="wrapper" style="position:relative;">
									<div class="survey"></div>
								</div>
								<div id="progressbar" style="background-color:#FFFFFF;"></div>
								<canvas id="circle" width="100" height="100"></canvas>
								<div class="navigation"></div>
							</div>
						</div>
						<div class="mask"></div>
						<div id="editPanel" class="window">
							<div class="head" >
								<span class="title"></span>
								<div class="close" onclick="closeEditPanel();"></div>
							</div>
							<div class="body"></div>
						</div>
			
					</div>
				</div>
				<!-- 问卷结束 -->
			</div>
		</div>
		<input type="hidden" id="websiteRootUrl" value="http://car.chexiang.com">
		
	</div>
	<!-- end | 贷款-->
	
	<inline src="include-html/footer.html" />
	<inline src="include-html/sidebar.html" />
	
	
	<script src="../common/js/lib/jquery_1_8_3.js"></script>
	
	<script src="../common/js/ecar/ECar.easyDialog.js"></script>
	
	<script src="js/public/suggest.js"></script>
	<script src="js/public/base.js"></script>
	<script src="js/public/common.js"></script>
	
	<script src="js/onlinefinance/loan/json.js"></script>
	<script src="js/onlinefinance/loan/jquery.fullPage-2.6.5.js"></script>
	<script src="js/onlinefinance/loan/jquery.json.js"></script>
	<script src="js/onlinefinance/loan/survey.js"></script>
	<script src="js/onlinefinance/loan/common.js"></script>
	<script src="js/onlinefinance/loan/jquery.slimscroll.js"></script>
	<script src="js/onlinefinance/loan/jquery-ui.js"></script>
	
	
	<script>
        var settings = {
            itemWidth: 135,
            itemHeight: 80,
            gap: 10,
            isTouchDevice: false,
            subOptionWidth: 135,
            iconPrefix: "",
            submitUrl: "/dev_credit/submitSurvey.do", //提交的url
            complete: function(count) {},
            submit: function(obj) { //问卷提交成功后的回调函数
            	
            	//window.location.href = "onlinefinance-result.min.html";
            	
                if (obj.code == 1000) {
                    $(window).unbind("unload");
                    var showResultRedirect = $("#websiteRootUrl").val() + "/pc/getCreditSurvey.do";
                    window.location.href = showResultRedirect;
                } else if (obj.code == 1400) {
                    $(".processTip").hide();
                    //$(".editFailed").children("p").text(obj.message);
                    var data = $(".summary").data("survey");
                    debug(data);
                    $(".editFailed").children("p").text("服务器太忙").css("margin-left", "45px");
                    $(".editFailed").show();
                    $(".editFailed").fadeOut(5000);
                } else {
                    $(window).unbind("unload");
                    var showResultRedirect = $("#websiteSecureUrl").val() + "/pc/financeFailed.do";
//                  window.location.href = showResultRedirect;
					window.location.href = "CreditSurvey.html";
                }
            }
        };

        $(document).ready(function() {
            var survey = $.loadSurvey("getSurveyInfo.do"); // 加载问卷
            $survey = $(".survey");
            $navigation = $(".navigation");
            $editor = $("#editPanel");
            buildSurveyHTML(survey);
            settings.count = survey.questions.length;

            $(".survey").fullpage({
                scrollingSpeed: 400, //
                navigation: false,
                resize: false,
                fitSection: true,
                continuousVertical: false,
                slidesNavigation: false,
                scrollOverflow: true,
                keyboardScrolling: false,
                touchSensitivity: 15,
                afterRender: function() {
                    settings.complete(settings.count);
                    $(".survey").fullpage.setAllowScrolling(false);
                },
                onLeave: leaveHandler
            });
            $("body").removeAttr("style");
            $("html").removeAttr("style");
            initFisrtAnswer();

            $(".question_count").text(survey.questions.length);
            // 选项点击
            $(window).on("unload", function() {
                var data = getData();
                var result = {};
                result.survey = $.toJSON(data);
                console.info("result:"+result);
                if (data.answers.length > 0) {
                    $.ajax({
                        type: "post",
                        url: "submitHalfSurvey.do",
                        async: false,
                        data: result,
                        dataType: "json"
                    });
                }
            });
        });
        /*js画布实现圆环*/
        function drawCircle(num, totalNum) {
            var percent = num * 100 / totalNum;
            $("#progressbar").progressbar({
                value: percent
            });
        }

        function getData() {
            //getAnswer();
            var survey = {};
            var root = $survey.data("survey");
            survey.id = root.code;
            survey.ip = "10.10.10.100";
            survey.client = "pc";
            var answers = new Array();

            $.each(root.questions, function(index) {
                var tmp = $survey.data("answer_" + index);
                if ((!(typeof(tmp) == "undefined")) && tmp != null && tmp != "") {
                    if ((!(typeof(tmp.value) == "undefined")) && tmp.value != null && tmp.value != "") {
                        answers.push(tmp);
                    }
                }
            });
            survey.answers = answers;
            return survey;
        }
        </script>

</body>
</html>